x86/xsave: fix information leak on AMD CPUs
authorJan Beulich <jbeulich@suse.com>
Tue, 4 Jun 2013 07:26:54 +0000 (09:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 4 Jun 2013 07:26:54 +0000 (09:26 +0200)
commit8dcf9f0113454f233089e8e5bb3970d891928410
tree94451a61f17566334a660ea47f06465531a46d49
parent5cffb77c4072fa5b46700a2dbb3e46c5a54eba6d
x86/xsave: fix information leak on AMD CPUs

Just like for FXSAVE/FXRSTOR, XSAVE/XRSTOR also don't save/restore the
last instruction and operand pointers as well as the last opcode if
there's no pending unmasked exception (see CVE-2006-1056 and commit
9747:4d667a139318).

While the FXSR solution sits in the save path, I prefer to have this in
the restore path because there the handling is simpler (namely in the
context of the pending changes to properly save the selector values for
32-bit guest code).

Also this is using FFREE instead of EMMS, as it doesn't seem unlikely
that in the future we may see CPUs with x87 and SSE/AVX but no MMX
support. The goal here anyway is just to avoid an FPU stack overflow.
I would have preferred to use FFREEP instead of FFREE (freeing two
stack slots at once), but AMD doesn't document that instruction.

This is CVE-2013-2076 / XSA-52.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
xen/arch/x86/xstate.c